package cn.netswap.jeegorilla.framework.security.social.weixin.providerinfo;

import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;
import org.springframework.social.oauth2.OAuth2Operations;

/**
 * @author lgw
 * @version 1.0
 * @date 2020/3/24 11:49
 */
public class WeiXinServiceProvider extends AbstractOAuth2ServiceProvider<WeiXin> {


    /**
     * 微信获取授权码的url
     */
    private static final String URL_AUTHORIZE = "https://open.weixin.qq.com/connect/qrconnect";
    /**
     * 微信获取accessToken的url
     */
    private static final String URL_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token";


    public WeiXinServiceProvider(String appId, String appSecret) {
        super(new WeiXinOauth2Template(appId, appSecret, URL_AUTHORIZE, URL_ACCESS_TOKEN));
    }

    @Override
    public WeiXin getApi(String accessToken) {
        return new WeiXinImpl(accessToken);
    }
}
